<template>
  <div class="attendance_result_report">

    <div class="tool">
      <div class="select">


        <el-form :inline="true">

          <el-form-item label="部门:">
            <el-select v-model="form.dept" placeholder="请选择部门..." @change="deptChange" size="small"
                       filterable clearable>
              <el-option :label="item.deptLevel2" :value="item.deptLevel2" v-for="item in deptList">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="组别:">
            <el-select v-model="form.groupName" placeholder="请选择组别..." size="small"
                       filterable clearable>
              <el-option :label="item.groupName" :value="item.groupName" v-for="item in groupList">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="异常情况:">
            <el-select v-model="form.exceptionDes" placeholder="请选择..." size="small" style="width: 30vw" filterable
                       clearable multiple>
              <el-option label="迟到" value="迟到"></el-option>
              <el-option label="早退" value="早退"></el-option>
              <el-option label="上班或下班未打卡" value="上班或下班未打卡"></el-option>
              <el-option label="旷工" value="旷工"></el-option>
              <el-option label="工作日排休" value="工作日排休"></el-option>
              <el-option label="超时加班未申请" value="超时加班未申请"></el-option>
              <el-option label="非工作日请了年假或调休" value="非工作日请了年假或调休"></el-option>
              <el-option label="在职期间内未排班" value="在职期间内未排班"></el-option>
              <el-option label="请假时间不足半天" value="请假时间不足半天"></el-option>
              <el-option label="薪资属性为空" value="薪资属性为空"></el-option>
              <el-option label="考勤数据异常" value="考勤数据异常"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="确认情况:">
            <el-select v-model="form.status" placeholder="请选择..." size="small" filterable clearable>
              <el-option label="全部" value=""></el-option>
              <el-option label="已确认" value="1"></el-option>
              <el-option label="待确认" value="0"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="姓名:">
            <el-select v-model="form.jobNumbers" placeholder="请选择员工姓名..." value-key="userId" size="small"
                       filterable clearable multiple>
              <el-option :label="item.userName+'（'+item.jobNo+'）'" :value="item.jobNo"
                         v-for="item in $store.state.userList">
                <span style="float: left">{{ item.userName }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.jobNo }}</span>
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="日期:">
            <el-date-picker size="small"
                            @change="dateChange"
                            v-model="attendanceDate"
                            type="daterange"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            align="left"
                            :picker-options="pickerOptions"
                            :clearable="false"
                            value-format="yyyy-MM-dd"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="handleChange" size="small">筛选</el-button>
            <el-button type="primary" @click="reSet" size="small" icon="el-icon-refresh">重置
            </el-button>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="goGetData" size="small">异常监控</el-button>
            <el-button type="warning" @click="handleConfigMultiple('CSPB','确定要重算排班数据吗？')" size="small">
              重算排班
            </el-button>
            <el-button type="warning" @click="handleConfigMultiple('CSDK','确定要重算打卡数据吗？')" size="small">
              重算打卡
            </el-button>
            <el-button type="warning" @click="handleConfigMultiple('CSSPSJ','确定要重算审批数据吗？')" size="small">
              重算审批数据
            </el-button>
            <el-button type="danger" @click="handleYcqrMultiple" size="small"
                       v-if="form.status != '' && form.status == 0 ">异常确认
            </el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-dialog title="异常监控" :visible.sync="getDataDialogFormVisible" center width="35%">
        <el-row>
          <el-form :model="form" label-width="3rem">
            <el-form-item label="姓名:">
              <el-select v-model="form.userId" placeholder="请选择员工姓名..." value-key="userId" size="small"
                         class="w100"
                         filterable clearable>
                <el-option :label="item.userName+'（'+item.jobNo+'）'" :value="item.userId"
                           v-for="item in $store.state.userList">
                  <span style="float: left">{{ item.userName }}</span>
                  <span style="float: right; color: #8492a6; font-size: 13px">{{ item.jobNo }}</span>
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="日期:">
              <el-date-picker v-model="attendanceDate" size="small"
                              type="daterange"
                              style="width: 100%"
                              align="left"
                              unlink-panels
                              @change="dateChange"
                              range-separator="至"
                              start-placeholder="开始日期"
                              end-placeholder="结束日期"
                              :picker-options="pickerOptions"
                              :clearable="false"
                              value-format="yyyy-MM-dd"
              >
              </el-date-picker>
            </el-form-item>
          </el-form>
        </el-row>
        <div slot="footer" class="dialog-footer">
          <el-button size="small" @click="getDataDialogFormVisible = false">取 消</el-button>
          <el-button size="small" type="primary" @click="checkData">确 定</el-button>
        </div>
      </el-dialog>

      <el-dialog title="异常确认" :visible.sync="ycqrDialogVisible" center width="45%">
        <el-row>
          <el-form :model="form" label-width="5rem">
            <el-form-item label="标签：" style="width: 70%">
              <el-select v-model="labels" placeholder="请选择异常标签..." value-key="name" size="small" class="w100"
                         multiple
                         filterable clearable>
                <el-option :label="item.name" :value="item" v-for="item in constLabels" :key="item.name"></el-option>
              </el-select>
            </el-form-item>
            <el-form :inline="true" :rules="labelRules" :model="zdyLabel" class="demo-form-inline" label-width="5rem"
                     ref="labelForm">
              <el-form-item label="自定义：" prop="name">
                <el-input v-model="zdyLabel.name" size="small" placeholder="请输入自定义标签"></el-input>
              </el-form-item>
              <el-form-item>
                <el-select v-model="zdyLabel.type" size="small" placeholder="请选择标签类型">
                  <el-option :label="item.name" :value="item.type" v-for="item in labelTypes"
                             :key="item.name"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-button size="small" type="primary" @click="addLabel">添加</el-button>
              </el-form-item>
            </el-form>
            <el-form-item>
              <el-tag
                  :key="tag.name"
                  v-for="tag in labels"
                  effect="dark"
                  :type="tag.type"
                  closable
                  :disable-transitions="false"
                  @close="handleCloseTag(tag)">
                {{ tag.name }}
              </el-tag>
            </el-form-item>
          </el-form>
        </el-row>
        <div slot="footer" class="dialog-footer">
          <el-button size="small" @click="ycqrDialogVisible = false">取 消</el-button>
          <el-button size="small" type="primary" @click="submitYcqr()">确 定</el-button>
        </div>
      </el-dialog>
    </div>
    <el-table
        id="table-detail"
        :data="tableData"
        border
        highlight-current-row
        @selection-change="handleSelectionChange"
        :row-class-name="tableRowClassName"
        :header-cell-style="{'text-align':'center'}"
        :cell-style="{'text-align':'center'}">
      <el-table-column
          type="selection"
          width="55">
      </el-table-column>
      <el-table-column label="员工姓名" prop="cuserName" width="100" fixed>
      </el-table-column>
      <el-table-column label="考勤日期" prop="dworkDate" min-width="180">
        <template slot-scope="scope" v-if="scope.row.dworkDate">
          {{ scope.row.dworkDate|formatDateBirth }}({{ scope.row.dworkDate|formatDateDDDD }})
        </template>
      </el-table-column>
<!--      <el-table-column label="星期" prop="dworkDate" min-width="80">-->
<!--        <template slot-scope="scope" v-if="scope.row.dworkDate">-->
<!--          {{ scope.row.dworkDate|formatDateDDDD }}-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column label="员工工号" prop="cjobNo" width="100">
      </el-table-column>
      <el-table-column label="所在部门" prop="cdept" :show-overflow-tooltip="true" width="100">
      </el-table-column>
      <!--      <el-table-column label="组别" prop="cgroupName" :show-overflow-tooltip="true" width="100">-->
      <!--      </el-table-column>-->
      <el-table-column label="班别" prop="bb" :show-overflow-tooltip="true" width="100">
      </el-table-column>
      <el-table-column label="上班时间" prop="onDuty" min-width="150">
        <template slot-scope="scope" v-if="scope.row.onDuty">
          {{ scope.row.onDuty|formatDate }}
        </template>
      </el-table-column>
      <el-table-column label="下班时间" prop="offDuty" min-width="150">
        <template slot-scope="scope" v-if="scope.row.offDuty">
          {{ scope.row.offDuty|formatDate }}
        </template>
      </el-table-column>
      <el-table-column label="异常情况" prop="cexceptionDes" min-width="350px" :show-overflow-tooltip="true">
      </el-table-column>
      <el-table-column label="已确认异常" min-width="200">
        <template slot-scope="scope">
          <el-tag
              :key="tag.name"
              v-for="tag in scope.row.labels"
              effect="dark"
              :type="tag.type"
              :disable-transitions="false">
            {{ tag.name }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="入职日期" prop="rzrq" :show-overflow-tooltip="true" min-width="150">
        <template slot-scope="scope" v-if="scope.row.rzrq">
          {{ scope.row.rzrq|formatDate }}
        </template>
      </el-table-column>
      <el-table-column label="离职日期" prop="lzrq" :show-overflow-tooltip="true" min-width="150">
        <template slot-scope="scope" v-if="scope.row.lzrq">
          {{ scope.row.lzrq|formatDate }}
        </template>
      </el-table-column>

      <el-table-column label="操作" min-width="200" fixed="right">
        <template slot-scope="scope">
          <el-link :underline="false" class="fd-padding-left fd-float-left"
                   type="primary"
                   @click="handleConfig(scope.row,'CLKQ','确定要重新拉取考勤数据吗？')">重拉考勤
          </el-link>
          <el-link :underline="false" class="fd-padding-left fd-float-left"
                   type="primary"
                   @click="handleConfig(scope.row,'CSPB','确定要重算排班数据吗？')">重算排班
          </el-link>
          <el-link :underline="false" class="fd-padding-left fd-float-left"
                   type="primary"
                   @click="handleConfig(scope.row,'CSDK','确定要重算打卡数据吗？')">重算打卡
          </el-link>
          <br>
          <el-link :underline="false" class="fd-padding-left fd-float-left"
                   type="primary"
                   @click="handleConfig(scope.row,'CSSPSJ','确定要重算审批数据吗？')">重算审批
          </el-link>
          <el-link :underline="false" class="fd-padding-left fd-float-left"
                   type="primary"
                   @click="goFillSalaryAttribute(scope.row)">薪资属性修复
          </el-link>
          <el-link v-if="scope.row.nstatus !== 1" :underline="false" class="fd-padding-left fd-float-left"
                   type="danger"
                   @click="openYcqrDialog(scope.row)">异常确认
          </el-link>
        </template>
      </el-table-column>
    </el-table>
    <div class="block">
      <el-pagination
          hide-on-single-page
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[size, size*2, size*3, size*4,total]"
          :page-size=size
          layout="total, sizes, prev, pager, next, jumper"
          :total=total>
      </el-pagination>
    </div>
    <el-dialog title="薪资属性维护" :visible.sync="salaryAttributeShow" width="30%">
      <el-form :model="salaryAttributeForm" size="small">
        <el-form-item label="员工姓名" :label-width="formLabelWidth">
          <el-input v-model="salaryAttributeForm.userName" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="档案日期" :label-width="formLabelWidth">
          <el-date-picker v-model="salaryAttributeForm.archivesDate" value-format="YYYY-MM-DD"></el-date-picker>
        </el-form-item>
        <el-form-item label="薪资属性" :label-width="formLabelWidth">
          <el-select v-model="salaryAttributeForm.salaryAttribute">
            <el-option v-for="item in salaryAttributeList" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="salaryAttributeShow = false">取 消</el-button>
        <el-button type="primary" @click="confirmFillSalaryAttribute">确 定</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import ToolBar from "@/components/common/ToolBar";
import moment from "moment";
import finUserRoster from "@/components/archivesmange/FinUserRoster.vue";

export default {
  name: "attendanceResultReport",
  components: {ToolBar},
  data() {
    var checkBasicAttendance = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('基本出勤时间不能为空'));
      }
      setTimeout(() => {
        if (value > 8) {
          callback(new Error('基本出勤时间不超过8小时...'));
        } else {
          callback();
        }

      }, 1000);
    };
    return {
      attendanceResultReport: {},
      currentPage: 1,
      total: 0,
      size: 5,
      tableData: [],
      dingUsersListName: null,
      dingUsersList: [],
      userList: [],
      isDowload: false,
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }]
      },
      dialogFormVisible: false,
      getDataDialogFormVisible: false,
      ycqrDialogVisible: false,
      form: {
        start: moment().add('days', -2).format("YYYY-MM-DD"),
        end: moment().format("YYYY-MM-DD"),
        userId: null,
        name: null,
        workDate: null,
        exceptionDes: [],
        jobNumbers: [],
        limit: 12,
        page: 1,
        status: null
      },
      formLabelWidth: '80px',
      timeResultList: [
        {
          label: "正常",
          value: "Normal",
        },
        {
          label: "早退",
          value: "Early",
        }, {
          label: "迟到",
          value: "Late",
        }, {
          label: "严重迟到",
          value: "SeriousLate",
        }, {
          label: "旷工迟到",
          value: "Absenteeism",
        }, {
          label: "未打卡",
          value: "NotSigned",
        },
      ],
      drawer: false,
      direction: 'rtl',
      attendanceResultList: [],
      popoverShow: false,
      row: {},
      attendanceDate: [moment().add('days', -2).format("YYYY-MM-DD"), moment().format("YYYY-MM-DD")],
      approve: {},
      innerDrawer: false,
      drawer1: false,
      multipleSelection: [],
      labels: [],
      zdyLabel: {
        name: '',
        type: ''
      },
      labelTypes: [
        {name: '默认', type: ''},
        {name: '警告', type: 'warning'},
        {name: '成功', type: 'success'},
        {name: '信息', type: 'info'},
        {name: '危险', type: 'danger'}
      ],
      constLabels: [
        {name: '义务加班', type: ''},
        {name: '实际未加班', type: 'warning'},
        {name: '非工作日晚到/提前下班', type: 'info'},
        {name: '请假与打卡数据无误', type: 'success'},
        {name: '迟到', type: 'danger'},
        {name: '早退', type: 'danger'},
        {name: '旷工', type: 'danger'},
        {name: '不在在职期间内', type: ''}
      ],
      isAdd: false,
      rules: {
        basicattendance: [
          {validator: checkBasicAttendance, trigger: "blur"}
        ]
      },
      deptList: [],
      groupList: [],
      labelRules: {
        name: [
          {required: true, message: '请输入自定义标签', trigger: 'blur'},
          {min: 1, max: 10, message: '长度在  到 10 个字符', trigger: 'blur'}
        ]
      },
      salaryAttributeShow:false,
      salaryAttributeForm:{
        userId:undefined,
        userName:undefined,
        attribute:undefined,
        start:undefined,
        end:undefined,
        archivesDate:undefined,
        salaryAttribute:undefined,
      },
      salaryAttributeList:[
        {
          label:"责任制",
          value:"责任制"
        },{
          label:"计时制",
          value:"计时制"
        },{
          label:"小时工",
          value:"小时工"
        }
      ]
    }
  },
  created() {
    this.getDataList()

  },
  mounted() {
    this.getDeptList()
  },
  methods: {
    handleCloseTag(tag) {
      this.labels.splice(this.labels.indexOf(tag), 1);
    },
    dateChange() {
      this.form.start = this.attendanceDate[0]
      this.form.end = this.attendanceDate[1]
    },
    numberChange() {
      this.attendanceResultReport.totalduration =
          parseFloat(this.attendanceResultReport.basicattendance)
          + parseFloat(this.attendanceResultReport.basicovertime) + parseFloat(this.attendanceResultReport.continuousshifthours) + parseFloat(this.attendanceResultReport.overtime)
    },
    setAddDialogVisible() {
      this.drawer1 = true
      this.isAdd = true
      this.attendanceResultReport = {}
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    getApprove(item) {
      console.log("Item;", item)
      const id = item.procinstId + item.userId
      axios.get("/ding_approve_list/get/" + id).then(res => {
        if (res.data.success) {
          this.innerDrawer = true
          this.approve = res.data.data
          console.log("Approve:", res.data.data)
        } else {
          this.approve = null
        }
      })
    },
    getDeptList() {
      axios.get("/fin_user_roster/deptList").then(res => {
        if (res.data.success) {
          this.deptList = res.data.data
        } else {
          this.deptList = []
        }
      })
    },
    deptChange() {
      this.getGroupList()


    },
    getGroupList() {
      axios.post("/fin_user_roster/groupList", {depts: [this.form.dept]}).then(res => {
        if (res.data.success) {
          this.groupList = res.data.data
        } else {
          this.groupList = []
        }
      })
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
          .then(_ => {
            this.drawer1 = false
            this.attendanceResultReport = {}
            done();
          })
          .catch(_ => {
          });
    },
    tableRowClassName({row, rowIndex}) {
      if ((row.basicattendance < 8 || row.basicattendance === null) && row.week !== '七') {
        return 'error-row';
      }
      return '';
    },
    goGetData() {
      this.getDataDialogFormVisible = true
    },
    handleEdit(row) {
      this.attendanceResultReport = row
      this.drawer1 = true
      this.isAdd = false

    },
    edit(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.attendanceResultReport.updateuserid = this.$store.state.userInfo.id
          axios.post("/attendance_result_report/update/" + this.$store.state.userInfo.id + "/" + this.$store.state.userInfo.name, this.attendanceResultReport).then(res => {
            if (res.data.success) {
              this.$tools.showMessage(res.data.message, "success")
              this.getDataList()
              this.drawer1 = false
              this.attendanceResultReport = {}
            } else {
              this.$tools.showMessage(res.data.message, "error")
            }
          })
        }
      })

    },
    openYcqrDialog(row) {
      this.ycqrDialogVisible = true;
      this.multipleSelection = [];
      this.multipleSelection.push(row);
    },
    submitYcqr() {
      if (this.labels.length < 1) {
        this.$tools.showMessage('还没有添加标签，无法进行异常确认操作！...')
        return
      }
      if (this.multipleSelection.length < 1) {
        this.$tools.showMessage("请选择要进行异常确认的行数据！", "error");
        return;
      }
      this.multipleSelection.forEach(item => {
        item.labels = this.labels;
      })
      this.$tools.openLoading();
      axios.put('/ycjk/attendance/opt', {
        opt: 'QRCZ',
        data: this.multipleSelection
      }).then(res => {
        this.ycqrDialogVisible = false;
        this.$tools.closeLoading();
        if (res) {
          this.$tools.showMessage("操作成功", "success")
          this.multipleSelection = [];
          this.labels = [];
          this.getDataList()
        } else {
          this.$tools.showMessage("操作失败", "error")
        }
      }).catch(error => {
        console.log(error);
        this.$tools.closeLoading();
      })
    },
    handleYcqrMultiple() {
      if (this.multipleSelection.length < 1) {
        this.$tools.showMessage("请先选择要操作的行数据！", "error");
        return
      }
      this.ycqrDialogVisible = true;
    },
    handleConfigMultiple(type, configMessage) {
      if (this.multipleSelection.length < 1) {
        this.$tools.showMessage("请先选择要操作的行数据！", "error");
        return
      }
      this.$tools.showMessageBox(configMessage, "操作确认", "warning").then(confirm => {
        this.$tools.openLoading();
        axios.put('/ycjk/attendance/opt', {
          opt: type,
          data: this.multipleSelection
        }).then(res => {
          this.ycqrDialogVisible = false;
          this.$tools.closeLoading();
          if (res) {
            this.$tools.showMessage("操作成功", "success")
            this.multipleSelection = [];
            this.getDataList()
          } else {
            this.$tools.showMessage("操作失败", "error")
          }
        }).catch(error => {
          this.$tools.closeLoading();
        })
      }).catch(cancel => {

      })
    },
    handleConfig(row, type, configMessage) {
      this.multipleSelection = [];
      this.multipleSelection.push(row);
      this.$tools.showMessageBox(configMessage, "操作确认", "warning").then(confirm => {
        this.$tools.openLoading();
        axios.put('/ycjk/attendance/opt', {
          opt: type,
          data: this.multipleSelection
        }).then(res => {
          this.ycqrDialogVisible = false;
          this.$tools.closeLoading();
          if (res) {
            this.$tools.showMessage("操作成功", "success")
            this.multipleSelection = [];
            this.getDataList()
          } else {
            this.$tools.showMessage("操作失败", "error")
          }
        }).catch(error => {
          this.$tools.closeLoading();
        })
      }).catch(cancel => {

      })
    },
    getDataList() {
      this.dialogFormVisible = false
      // this.form.start=this.attendanceDate[0]
      // this.form.end=this.attendanceDate[1]
      this.form.limit = this.size;
      this.form.page = this.currentPage;
      console.log("查询数据：", this.form)
      axios.post("/ycjk/attendance/list", this.form).then(res => {
        if (res.status === 200) {
          this.tableData = res.data.records;
          this.total = res.data.total;
          this.pages = res.data.pages;
        } else {
          this.tableData = []
          this.total = 0
          this.pages = 1
        }

      }).catch(error => {
        console.log(error);
      })
    },
    handleSizeChange(val) {
      this.size = val
      this.getDataList()
    },
    handleCurrentChange(val) {
      this.currentPage = val
      this.getDataList()
    },
    reSet() {
      this.currentPage = 1;
      this.form = {
        start: moment().format("YYYY-MM-DD"),
        end: moment().format("YYYY-MM-DD"),
        userId: null,
        workDate: null,
        exceptionDes: null,
        status: null,
        limit: 12,
        page: 1
      }
      this.getDataList()
    },
    handleChange() {
      this.currentPage = 1;
      this.getDataList()
    },
    deleteById() {
      console.log("用户扫描删除")
      this.$tools.showMessageBox("确认删除选择的：" + this.multipleSelection.length + "条考勤数据？", "操作确认", "warning").then(confirm => {
        axios.post("/attendance_result_report/deleteBatch" + this.$store.state.userInfo.id + "/" + this.$store.state.userInfo.name, this.multipleSelection).then(res => {
          if (res.data.success) {
            this.$tools.showMessage(res.data.message, "success")
            this.getDataList()
          } else {
            this.$tools.showMessage(res.data.message, "error")
          }
        })
      }).catch(cancel => {
        this.$tools.showMessage("操作取消！", "info")
      })
    },
    checkData() {
      this.form.start = moment(this.attendanceDate[0]).format("YYYY-MM-DD")
      this.form.end = moment(this.attendanceDate[1]).format("YYYY-MM-DD")
      console.log("查询数据：", this.form)
      this.$tools.openLoading()
      axios.post("/ycjk/attendance/check", this.form).then(res => {
        if (res.status === 200) {
          this.getDataList()
          this.$tools.closeLoading();
          this.getDataDialogFormVisible = false;
        }
      }).catch(error => {
        this.$tools.showMessage("考勤结果异常检查出错！", "error");
        console.log(error);
        this.$tools.closeLoading();
      })
    },
    addLabel() {
      this.$refs.labelForm.validate((valid) => {
        if (valid) {
          const xzLabels = this.labels.filter(item => item.name == this.zdyLabel.name)
          const clLabels = this.constLabels.filter(item => item.name == this.zdyLabel.name)
          if ((xzLabels && xzLabels.length > 0) || (clLabels && clLabels.length > 0)) {
            this.zdyLabel = {
              name: '',
              type: ''
            };
            this.$tools.showMessage('当前标签已经存在，请重新添加！', 'error')
            return
          }
          this.labels.push(this.zdyLabel);
          this.constLabels.push(this.zdyLabel);
          this.zdyLabel = {
            name: '',
            type: ''
          };
        }
      });
    },
    goFillSalaryAttribute(row){
      let data=this.$tools.deepClone(row)
        this.salaryAttributeForm.userName=data.cuserName
        this.salaryAttributeForm.archivesDate=data.dworkDate
        this.salaryAttributeForm.userId=data.cuserId
        this.salaryAttributeShow=true
    },
    confirmFillSalaryAttribute(){
      axios.post("/fin_user_roster/updateSalaryAttribute",this.salaryAttributeForm).then(res => {
        if(res.data.success){
          this.multipleSelection = [];
          this.getDataList()
          this.salaryAttributeShow=false
        }
      })
    }
  },

}
</script>

<style scoped lang="less">
.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}

.el-icon-arrow-down {
  font-size: 12px;
}

.attendance_result_report {
  .select {
    //margin-bottom: 0.1rem;
    display: inline-flex !important;
  }

  .el-input--suffix .el-input__inner {
    padding-right: 0;
  }

  .fd-float-left {
    float: left;
  }

  .fd-padding-left {
    padding-left: 10px;
  }
}

</style>
